<template>
    <div>
        msg  <input v-model="key"/>
        <button @click="getKey">获取</button>
    </div>
</template>

<script setup>
import  {computed} from  "vue";
let props = defineProps(["msg"]);
let emits  = defineEmits(["changeMsg"]);

let  getKey  = ()=>{
    console.log(key.value);
}

let  key = computed({
    set(value){
        emits("changeMsg",value);
    },
    get(){
        return  props.msg;
    }
})


</script>

<style>

</style>